Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eth-rpc-errors

Package Overview
Dependencies
Maintainers
4
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eth-rpc-errors

Ethereum RPC and Provider errors.

  • 4.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
4
Created

What is eth-rpc-errors?

The eth-rpc-errors package provides utilities for creating and managing Ethereum JSON-RPC errors. It helps standardize error handling in Ethereum-related applications by providing predefined error codes and messages.

What are eth-rpc-errors's main functionalities?

Creating Custom Errors

This feature allows you to create custom errors with specific codes, messages, and additional data. It is useful for defining application-specific error conditions.

const { ethErrors } = require('eth-rpc-errors');

const customError = ethErrors.rpc.custom({
  code: 1234,
  message: 'Custom error message',
  data: { additional: 'info' }
});

console.log(customError);

Predefined Errors

The package provides predefined errors for common JSON-RPC error conditions, such as invalid parameters, method not found, and internal errors. This helps standardize error responses across different applications.

const { ethErrors } = require('eth-rpc-errors');

const invalidParamsError = ethErrors.rpc.invalidParams('Invalid parameters provided');

console.log(invalidParamsError);

Error Serialization

This feature allows you to serialize JavaScript errors into a format that can be easily transmitted over JSON-RPC. It ensures that error information is consistently formatted.

const { serializeError } = require('eth-rpc-errors');

const error = new Error('Something went wrong');
const serializedError = serializeError(error);

console.log(serializedError);

Other packages similar to eth-rpc-errors

Keywords

FAQs

Package last updated on 11 Mar 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc